<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>个人中心显示</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./js/jquery-3.6.0-min.js"></script>
    <script src="./layer/layer.js"></script>
</head>
<style>
    table {
        margin: 0 auto;
        /* border: 1px solid #000; */
    }

    /* td{ */
    /* border: 1px solid #000; */
    /* } */
    /* table tbody tr:nth-child(1){
        text-align: right;
        
    } */
</style>

<body>
    <table width="400px" height="200px">
        <caption>个人用户显示</caption>
        <thead>
        </thead>
        <tbody>
            <tr>
                <td style=" text-align: right; ">姓名：</td>
                <td class="username"></td>
            </tr>
            <tr>
                <td style=" text-align: right;">密码：</td>
                <td class="password"></td>
            </tr>
            <tr>
                <td style=" text-align: right;">手机号：</td>
                <td class="tel"></td>
            </tr>
            <tr>
                <td style=" text-align: right;">昵称：</td>
                <td class="nickname"></td>
            </tr>
            <tr>
                <td></td>
                <td><a href="./editinfo.html">修改个人信息</a></td>
                <td><a href="./editpsd.html">修改密码</a></td>
            </tr>
        </tbody>
    </table>
</body>
<script>
    // 获取用户的信息
    var data = localStorage.getItem('userInfo')
    if (!data) {
        layer.msg('未登录', {
            icon: 2,
            time: 1000
        }, () => {
            localStorage.setItem('url', location.href)
            location.href = "login.html"
        })
    } else {
        data = JSON.parse(data)
        console.log(data);
        $('.username').text(data.username)
        $('.password').text(data.password)
        $('.tel').text(data.tel)
        $('.nickname').text(data.nickname)
    }

</script>

</html>